// Copyright (C) 1997-2002 Alias|Wavefront,
// a division of Silicon Graphics Limited.
//
// The information in this file is provided for the exclusive use of the
// licensees of Alias|Wavefront.  Such users have the right to use, modify,
// and incorporate this code into other products for purposes authorized
// by the Alias|Wavefront license agreement, without fee.
//
// ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
// EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
//
//
//  Alias|Wavefront Script File
//  MODIFY THIS AT YOUR OWN RISK
//
//  Creation Date:  24.Jan.2002
//
//<doc>
//<name addAttributeEditorNodeHelp>
//<owner "Alias|Wavefront Unsupported">
//
//<synopsis>
//		addAttributeEditorNodeHelp(string $nodeType, string $helpCommand)
//
//<description>
//		The Attribute Editor's Help menu creates menu items
//		for node types that it is currently displaying. For custom
//		node types use this procedure to specify a help command
//		to be invoked when the custom node type menu item is
//		selected.
//
//<flags>
//		string $nodeType The node type.
//
//		string $helpCommand The command to display help for the node.
//			This command is invoked when the corresponding menu item is 
//			selected from the Attribute Editor Help menu. Specify an 
//			empty string to prevent the menu item for the node type
//			from being created.
//
//<returns>
//		Nothing.
//
//<examples>
//
//	//	Prevent a menu item in the Help menu from being
//	//	created for nodes of type "customNodeType1".
//	//
//	addAttributeEditorNodeHelp("customNodeType1", "");
//
//	//	Use the showHelp command to display a specific web page
//	//	when the "customNodeType2" Help menu item is selected.
//	//
//	addAttributeEditorNodeHelp("customNodeType2",
//		"showHelp -absolute \"http://www.aliaswavefront.com\"");
//
//	//	Use the print command to inform user no help is available
//	//	for "customNodeType3".
//	//
//	addAttributeEditorNodeHelp("customNodeType3",
//		"print \"No help available yet for customNodeType3\\n\"");
//
//</doc>

global proc addAttributeEditorNodeHelp(
	string $nodeType,
	string $helpCommand)
{
	global string $gAttributeEditorNodeTypeArray[];
	global string $gAttributeEditorHelpCommandArray[];

	int $count, $index, $length;

	$length = size($gAttributeEditorNodeTypeArray);

	//	Determine if the argument node type is already in the
	//	array.
	//
	$count = stringArrayCount($nodeType, $gAttributeEditorNodeTypeArray);
	
	if (0 == $count) {
		//
		//	Not in array yet.
		//
		//	Add node type and help command.
		//
		$gAttributeEditorNodeTypeArray[$length] = $nodeType;
		$gAttributeEditorHelpCommandArray[$length] = $helpCommand;

	} else {
		//
		//	Already in array.
		//
		//	Find index of node in array.
		//
		for ($index = 0; $index < $length; $index++) {
			if ($nodeType == $gAttributeEditorNodeTypeArray[$index]) {
				break;
			}
		}

		//	Update help command.
		//
		$gAttributeEditorHelpCommandArray[$index] = $helpCommand;
	}
}

